package com.company;

import java.util.Comparator;

public class Student implements Comparable<Student> {
    private int stu_no;
    private String name;
    private int age;

    public Student(int stu_no, String name, int age) {
        this.stu_no = stu_no;
        this.name = name;
        this.age = age;
    }

    public Student() {
    }

    @Override
    public int compareTo(Student stu) {
        int i = 0;

        if(this.stu_no> stu.stu_no){
            i =  -1;
        }

        if(this.stu_no< stu.stu_no){
            i = 1;
        }

        return i;
    }

    @Override
    public String toString() {
        return "学号:"+this.stu_no + "\t姓名:" + this.name+ "\t年龄：" + this.age;
    }
}
